//package com.xiaotao.test01.controller;
//
//import com.alibaba.fastjson2.JSON;
//import com.xiaotao.test01.service.TestService;
//import lombok.AllArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.ServletInputStream;
//import javax.servlet.http.HttpServletRequest;
//import java.io.ByteArrayOutputStream;
//import java.util.Map;
//
///**
// * @author xiaotao
// * @create 2023/2/28 14:25
// */
//@Slf4j
//@RestController
//@RequestMapping("test01")
//@AllArgsConstructor
//public class Test01Controller {
//    private final HttpServletRequest request;
//    private final TestService testService;
//
//    /**
//     *  @RequestBody 后可以用Map接收各个参数 但使用后request不能再获取
//     * @param map 接收的前端参数
//     * @throws Exception 异常
//     */
//    @RequestMapping("from2json")
//    public void from2json(@RequestBody Map<String,Object> map) throws Exception{
//        ServletInputStream inputStream = request.getInputStream();
//        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
//        byte[] b = new byte[1024];
//        int n;
//        while ((n = inputStream.read(b)) != -1) {
//            outputStream.write(b, 0, n);
//        }
//        String out = outputStream.toString();
//        String json = JSON.toJSONString(out);
//        System.out.println(json);
//        System.out.println(JSON.toJSONString(map));
//    }
//
//    @RequestMapping("threadTest")
//    public void threadTest() throws Exception{
//        testService.threadTest();
//
//    }
//}
